package com.bl.student.service.vo.roaste;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * Created by liangweikang on 20/10/21.
 */
public class RoastData extends AbstractModel {
    private int id;
    private ArrayList<Float> timeArray;
    private ArrayList<Float> beanTemperatureArray;
    private ArrayList<Float> environmentTemperatureArray;
    private ArrayList<Integer> firepowerArray;
    private ArrayList<Integer> damperArray;
    private ArrayList<Integer> motorSpeedArray;

    public RoastData() {
        timeArray = new ArrayList<>(900);
        beanTemperatureArray = new ArrayList<>(900);
        environmentTemperatureArray = new ArrayList<>(900);
        firepowerArray = new ArrayList<>(900);
        damperArray = new ArrayList<>(900);
        motorSpeedArray = new ArrayList<>(900);
    }

    public void add(float time, float BT, float ET, int FP, int DP, int MS) {
        timeArray.add(time);
        beanTemperatureArray.add(BT);
        environmentTemperatureArray.add(ET);
        firepowerArray.add(FP);
        damperArray.add(DP);
        motorSpeedArray.add(MS);
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int size() {
        return timeArray.size();
    }

    public List<Float> getTimeArray() {
        return Collections.unmodifiableList(timeArray);
    }

    public List<Float> getBeanTemperatureArray() {
        return Collections.unmodifiableList(beanTemperatureArray);
    }

    public List<Float> getEnvironmentTemperatureArray() {
        return Collections.unmodifiableList(environmentTemperatureArray);
    }

    public List<Integer> getFirepowerArray() {
        return Collections.unmodifiableList(firepowerArray);
    }

    public List<Integer> getDamperArray() {
        return Collections.unmodifiableList(damperArray);
    }

    public List<Integer> getMotorSpeedArray() {
        return Collections.unmodifiableList(motorSpeedArray);
    }

    @Override
    void doRecover(AbstractModel model) {
        RoastData anotherRoastData = (RoastData) model;

        this.timeArray = anotherRoastData.timeArray;
        this.beanTemperatureArray = anotherRoastData.beanTemperatureArray;
        this.environmentTemperatureArray = anotherRoastData.environmentTemperatureArray;
        this.firepowerArray = anotherRoastData.firepowerArray;
        this.damperArray = anotherRoastData.damperArray;
        this.motorSpeedArray = anotherRoastData.motorSpeedArray;
    }
}
